/*
 * Copyright (c) 2021. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
 * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
 * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
 * Vestibulum commodo. Ut rhoncus gravida arcu.
 */

package com.pobing.service.web;

import com.google.protobuf.Any;
import com.pobing.protobuf.lib.revert.Revert;
import com.pobing.protobuf.lib.user.User;
import org.joda.time.DateTime;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xfworld
 * @since create on 2021-12-03.
 **/
@RestController
@RequestMapping("/test")
public class TestController {

    @PostMapping(value = "/getTime",produces = "application/x-protobuf",consumes = "application/x-protobuf")
    public Revert getTime(@RequestBody User user){
        System.out.println(user.getId() +" = " + user.getUserName() + " , " +user.getPhone());
        return Revert.newBuilder().setStatus(true).setCode(200).setMessage("测试成功" + DateTime.now().toString("yyyy-MM-dd HH:mm:ss")).setData(Any.pack(user)).build();
    }


}
